package com.wwg.springboard.shortcut;

import java.util.Objects;

public class Shortcut implements IShortcut {
    public String name = "";
    public String description = "";
    public String iconUrl = "";
    public boolean subscribe = false;
    public int iconRes = 0;
    public int groupPosition = -1;

    public Shortcut(String name, String description, String iconUrl, boolean subscribe, int iconRes) {
        this.name = name;
        this.description = description;
        this.iconUrl = iconUrl;
        this.subscribe = subscribe;
        this.iconRes = iconRes;
    }

    public Shortcut(String name, String description, String iconUrl, boolean subscribe) {
        this.name = name;
        this.description = description;
        this.iconUrl = iconUrl;
        this.subscribe = subscribe;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Shortcut shortcut = (Shortcut) o;
        return subscribe == shortcut.subscribe &&
                iconRes == shortcut.iconRes &&
                groupPosition == shortcut.groupPosition &&
                name.equals(shortcut.name) &&
                description.equals(shortcut.description) &&
                iconUrl.equals(shortcut.iconUrl);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, description, iconUrl, subscribe, iconRes, groupPosition);
    }

    @Override
    public String toString() {
        return "Shortcut{" +
                "name='" + name + '\'' +
                ", description='" + description + '\'' +
                ", iconUrl='" + iconUrl + '\'' +
                ", subscribe=" + subscribe +
                ", iconRes=" + iconRes +
                ", groupPosition=" + groupPosition +
                '}';
    }
}
